//
//  CSYBasicNavController.swift
//  CSYMicroBlockSina
//
//  Created by 姚彦兆 on 15/11/16.
//  Copyright © 2015年 姚彦兆. All rights reserved.
//

import UIKit

class CSYBasicNavController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    override func pushViewController(viewController: UIViewController, animated: Bool) {
        
        if self.childViewControllers.count != 0 {
        
            self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "返回", style: UIBarButtonItemStyle.Plain, target: self, action: "back")
            
            self.hidesBottomBarWhenPushed = true

            self.hidesBarsWhenKeyboardAppears = true
            
        }
        
        super.pushViewController(viewController, animated: animated)
        
    }
    
    @objc private func back(){
    
        self.popViewControllerAnimated(true)
    
    }
    

}
